package xijia.plus.docs.thymeleafuser.config;

import io.github.wslxm.springbootplus2.core.utils.PropUtil;
import io.github.wslxm.springbootplus2.core.utils.bean.SpringContextUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import xijia.plus.docs.thymeleafuser.properties.DocProperties;

/**
 *
 * 项目完全启动成功后的执行的一些处理操作
 * @author wangsong
 * @mail 1720696548@qq.com
 * @date 2020/7/23 0023 9:04
 * @version 1.0.1
 */
@Component
@Slf4j
public class DocCommandLineRunnerImpl implements CommandLineRunner {


    @Autowired
    private DocProperties docProperties;

    @Override
    public void run(String... args) {
        // 当前启动环境
        log.info("当前启动环境 spring.profiles.active = {}", SpringContextUtil.getActiveProfile());
        Object port = PropUtil.findByKey("server.port");
        log.info("当前启动端口 server.port={}", port);
        log.info("当前租户 tenantName={}", docProperties.getTenantName());
        log.info("本地访问地址: {}", "http://127.0.0.1:" + port);
    }
}